﻿//
// Copyright (c) 2024 BPer
//
#include "bperWinVideoCaptureHandle.h"

#if BPer_OS_WIN

#include <strmif.h>


BPerWinVideoCaptureHandle::BPerWinVideoCaptureHandle(BPerVideoInfo *pcontext):BPerVideoCaptureHandle(pcontext)
{

}
BPerWinVideoCaptureHandle:: ~BPerWinVideoCaptureHandle(void){

}
STDMETHODIMP_(ULONG) BPerWinVideoCaptureHandle::AddRef() {
	return 1;
}
STDMETHODIMP_(ULONG) BPerWinVideoCaptureHandle::Release() {
	return 2;
}

STDMETHODIMP BPerWinVideoCaptureHandle::QueryInterface(REFIID riid,
		void **ppvObject) {

	if (NULL == ppvObject)
		return E_POINTER;
	if (riid == __uuidof(IUnknown)) {
		*ppvObject = static_cast<IUnknown*>(this);
		return S_OK;
	}
	if (riid == IID_ISampleGrabber) {
		*ppvObject = static_cast<ISampleGrabberCB*>(this);
		return S_OK;
	}
	return E_NOTIMPL;
}

STDMETHODIMP BPerWinVideoCaptureHandle::SampleCB(double Time,
		IMediaSample *pSample) {

	return E_NOTIMPL;
}

STDMETHODIMP BPerWinVideoCaptureHandle::BufferCB(double Time, BYTE *pBuffer,
		long BufferLen) {

	putBuffer(Time*1000000, pBuffer, BufferLen);
	return E_NOTIMPL;
}

#endif
